/*
 * StateGame.h
 *
 *  Created on: 06/04/2013
 *      Author: Vitor
 */

#ifndef StateGame_H_
#define StateGame_H_

#include <stdlib.h>
#include "Camera.h"
#include "SDLBase.h"
#include "Sprite.h"
#include "Planet.h"
#include "Moon.h"
#include "PlanetRed.h"
#include "Earth.h"
#include "FollowerObject.h"
#include "TileSet.h"
#include "TileMap.h"
#include "InputManager.h"
#include "AcceleratedObject.h"
#include "Point.h"
#include "State.h"
#include "StateArgs.h"
#include "Text.h"
#include "Sound.h"
#include "Music.h"
#include "Timer.h"
#include "BulletManager.h"
#include "Bullet.h"
#include <vector>

#define SCROLL 20.0f
#define TILE_SIZE 75
#define TILEMAP_SIZE 16
#define N_TEXTURES 30
#define FPS 30.0

#define PLANET_COOLDOWN 1000

class StateGame: public State {
private:
	Sprite* background;
	Sprite* redPlanetSprite;
	Sprite* earthSprite;
	Sprite* moonSprite;
	Sprite* ufoSprite;
	Sprite* bulletSprite;
	Sprite* redLifeBarBlockSprite;
	Sprite* yellowLifeBarBlockSprite;
	Sprite* lifeContainerBotSprite;
	Sprite* lifeContainerTopSprite;
	Sprite* lifeContainerMidSprite;
	TileSet* tileSet;
	TileMap* tileMap;
	std::vector<Planet*> planetArray;
	Earth* earth;
	Moon* moon;
	FollowerObject* ufo;
	AcceleratedObject* ship;
	Animation* shipAnimation;
	Animation* boom;
	Music* backgroundMusic;
	Sound* boomExplosion;
	Text* shipCommands;
	Text* ufoMoveCommands;
	Text* ufoPlanetCommands;
	Text* pauseCommand;
	Timer planetTimer;
	Timer shipWinTimer;
	Timer ufoWinTimer;
	Point boomPos;

	struct {
		float x;
		float y;
	} cameraSpeed;
	bool quit;
	bool pause;
	int lifeContainerSize;

	void renderLifeBar();
	void pauseAllTimers();
	void resumeAllTimers();

public:
	StateGame();
	virtual ~StateGame();
	void addPlanet();
	void checkPlanets(int dt);
	void input();
	int update(double dt);
	void checkCollisions(int dt);
	void render();
	void load(StateArgs arguments);
	StateArgs unload();
};

#endif /* StateGame_H_ */
